package com.example.yqand4v1_1.dao;

import com.example.yqand4v1_1.dao.entity.Team;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
@Mapper
@Component
public interface TeamEntityMapper {
    /**
     * @param count 页数
     * @param amount 每次查询的数量
     * @return amount个team对象
     */
    ArrayList<Team> queryTeamsByAmount(@Param("count")int count,@Param("amount")int amount);

    /**
     * @param team 团队信息
     * @return 返回创建的团队信息
     */
    Integer addTeam(Team team);

    /**
     * @param volunteerId 志愿者id
     * @param teamId 团队id
     * @return 插入是否成功
     */
    Integer participateTeam(@Param("volunteerId")int volunteerId,@Param("teamId")int teamId);

    /**
     * 通过id查询team
     * @param teamId 团队id
     * @return 单个团队信息
     */
    Team querySingleTeamById(int teamId);

    /**
     * 通过志愿者id查找team_id
     * @param volunteerId 志愿者id
     * @return team的id
     */
    Integer queryTeamIdOfVolunteer(int volunteerId);

    /**
     * 更新团队人数
     * @param peopleNum 人数
     * @param teamId 团队id
     * @return 更新是否成功
     */

    Integer updatePeopleNumOfTeam(@Param("peopleNum")int peopleNum,@Param("teamId")int teamId);

    /**
     * 查询团队总数
     * @return 团队总数
     */

    int queryTotalNumOfTeams();

}
